package com.vhall.component.entity.room.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author shimingming
 * @since 2023/3/6 16:55
 */
@Getter
@AllArgsConstructor
public enum TerminalEnum {

    iOSAPP(0, "iOSAPP"),
    ANDROIDAPP(1, "AndroidAPP"),
    FLASH(2, "flash"),
    WAP(3, "wap"),
    IOSSDK(4, "IOSSDK"),
    ANDROIDSDK(5, "AndroidSDK"),
    ASSITANT(6, "小助手"),
    JSWEB(7, "JS播放器WEB端"),
    NO(8, "未定义"),
    WECHAT(9, "微信小程序"),
    JSWAP(10, "JS播放器WAP端"),


    ;
    private Integer value;

    private String description;

    public static String getDescription(Integer value) {
        TerminalEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescription();
        }
        return StringUtils.EMPTY;
    }

    public static TerminalEnum parse(Integer value) {
        for (TerminalEnum anEnum : TerminalEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
